package com.example.node.message;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/*
 * @className: Response
 * @author: chentao
 * @date: 2025/10/25 下午5:23
 * @Version: 1.0
 * @description:
 */
public class Response implements Serializable {

    private Request request;

    private long senderId;

    private Object message;

    private long responseTime;

    private boolean isTimeout = false;

    private boolean isSuccess;

    private Map<String, Object> properties = new HashMap<>();

    public Request getRequest() {
        return request;
    }

    public void setRequest(Request request) {
        this.request = request;
    }

    public Object getMessage() {
        return message;
    }

    public void setMessage(Object message) {
        this.message = message;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public Response(Request request) {
        this.request = request;
    }

    public boolean isTimeout() {
        return isTimeout;
    }

    public void setTimeout(boolean timeout) {
        isTimeout = timeout;
    }

    public long getSenderId() {
        return senderId;
    }

    public void setSenderId(long senderId) {
        this.senderId = senderId;
    }

    public long getResponseTime() {
        return responseTime;
    }

    public void setResponseTime(long responseTime) {
        this.responseTime = responseTime;
    }

    public Map<String, Object> getProperties() {
        return properties;
    }

    public void setProperties(Map<String, Object> properties) {
        this.properties = properties;
    }

    public Response(Request request, boolean isSuccess, Object message) {
        this.request = request;
        this.isSuccess = isSuccess;
        this.message = message;
        this.responseTime = System.currentTimeMillis();
    }
}
